import React, { Component, PureComponent } from "react";

// 1.安装 npm install prop-types --save

// 2. 引入PropTypes
import PropTypes from "prop-types";

// 类组件 父传子 
class Star extends Component {
  render() {
  return <div>{this.props.title}{this.props.num}</div>;
  }
}
// 3. 验证
Star.propTypes = {
  title:PropTypes.string,
  num:PropTypes.number
}

export default class App extends Component {
  render() {
    return (
      <div>
        <Star title="⭐⭐⭐⭐⭐" num={123}></Star>
      </div>
    );
  }
}
